#include<stdio.h>
#include<unistd.h>
 int main(){
      int i=10;
      char buffer[4];
       while(i>=0){
       snprintf(buffer,sizeof(buffer),"%-2d",i);
          printf("\r%s",buffer);
          fflush(stdout);//刷新缓冲区                       
          i--;
          sleep(1);
      }
      printf("\n");
      return 0;
 }
